{extend name="public/base"}

{block name="title"}就行天下-约酒交友{/block}

{block name="style"}
<link rel="stylesheet" href="__STATIC__/home/css/index.css" />
{/block}

{block name="main"}
<div class="pageControl bg-f7">
    <div class="main-top"></div>
    <div class="msui_nav msui_navTop noBorder">
        <a class="msui_navTop-back open-popup" href="javascript:;" data-target="#noOrder"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">收银台</h1>
        <a href="" class="msui_navTop-right msui_navTop-cnav"><i class="micon-cnav"></i></a>
    </div>
    <div class="payment">
        <div class="weui-cell weui-cell_access">
            <div class="weui-cell__bd ">
                <p class="fs065">订单号：{$data.order_sn}</p>
            </div>
        </div>
        {notin name="data.model" value="activity"}
        <div class="weui-cell weui-cell_switch">
            <div class="weui-cell__bd ">
                <p class="fs065">使用琼露</p>
            </div>
            <div class="weui-cell__ft fs06">
                <p class="cl-c40 mr03 judge-lu">无可用琼露</p>
                <!--有琼露-->
                <!--<p class="cl-c40 mr03 judge-lu">每单限2000点琼露</p>-->
                <!--开开开关-->
                <!--<p class="cl-c40 mr03 judge-lu"><span class="luCount">2</span>滴琼露抵现<span class="luCount-money"></span>元</p>-->
            </div>
            <div class="weui-cell__ft fs06">
                <label for="switchCP-lu" id="switchCP-lu1"  class="weui-switch-cp">
                    <input id="switchCP-lu"  class="weui-switch-cp__input" type="checkbox" name="user_integral">
                    <div class="weui-switch-cp__box"></div>
                </label>
            </div>
        </div>
        {/notin}
        {notin name="data.model" value="activity"}
        <div class="weui-cell weui-cell_access">
            <div class="weui-cell__bd ">
                <p class="fs065">使用优惠券</p>
            </div>
            <div class="weui-cell__ft fs06">
                <span class="cl-c40 mr03 judge-coupon">无可用优惠券</span>
            </div>
        </div>
        {/notin}
        <label class="weui-cell weui-check__label">
            <div class="weui-cell__bd">
                <div class="msui_table">
                    <div class="msui_tabCell-img">
                        <img src="__STATIC__/home/images/payPhoto3.png">
                    </div>
                    <div class="msui_tabCell-content">
                        <p class="fs07 cl-3333">微信支付</p>
                        <p class="fs07 cl-9999">推荐安装微信5.0及以上的版本使用</p>
                    </div>
                </div>
            </div>
            <div class="weui-cell__ft">
                <input type="checkbox" class="weui-check" name="chooseBox" value="微信支付" >
                <i class="micon-check micon-checked" data-pay-type="wxpay"></i>
            </div>
        </label>
        {eq name="data.model" value="order"}
        <label class="weui-cell weui-check__label">
            <div class="weui-cell__bd">
                <div class="msui_table">
                    <div class="msui_tabCell-img">
                        <img src="__STATIC__/home/images/payPhoto1.png">
                    </div>
                    <div class="msui_tabCell-content">
                        <p class="fs07 cl-3333">余额支付</p>
                        <p class="fs07 cl-9999">推荐余额支付</p>
                    </div>
                </div>
            </div>
            <div class="weui-cell__ft">
                <input type="checkbox" class="weui-check" name="chooseBox" value="中国工商银行储蓄卡(5423)">
                <i class="micon-check" data-pay-type="money"></i>
            </div>
        </label>
        {/eq}
    </div>

    <div class="order-ok-btn_1">
        <div class="">
            <p class="fs065">总计: <span class="cl-c40">￥{$data.price}</span>元</p>
        </div>
        <a href="javascript:;" class="cl-f submitOrder">确认支付</a>
    </div>
</div>

<!--没有支付密码-->
{include file="public/noPassword" /}
<!--有支付密码-->
{include file="public/paymentPassword" /}
<!--舍弃订单-->
<div id="noOrder" class="centerPopup weui-popup__container">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="fs065 title">
            <p>宝贝错过就没有啦</p>
            <p>真的不要了吗？</p>
        </div>
        <div class="model-btn-two">
            <a href="javascript:history.back();">忍痛舍弃</a>
            <a href="" class="close-popup">要要要</a>
        </div>
    </div>
</div>
<!--支付成功-->
<div id="paySucc" class="weui-popup__container">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="msui_nav msui_navTop noBorder">
            <a class="msui_navTop-back close-popup" href="javascript:;"><i class="micon-back"></i></a>
            <h1 class="msui_navTop-title">付款结果</h1>
            <a href="" class="msui_navTop-right msui_navTop-cnav"><i class="micon-cnav"></i></a>
        </div>
        <div class="payResult">
            <img src="__STATIC__/home/images/succ.png" alt="">
            <p class="fs07 text-center mtop08">付款成功</p>
        </div>
    </div>
</div>
<!--支付失败-->
<div id="payDefeated" class="weui-popup__container">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="msui_nav msui_navTop noBorder">
            <a class="msui_navTop-back close-popup" href="javascript:;"><i class="micon-back"></i></a>
            <h1 class="msui_navTop-title">付款结果</h1>
            <a href="" class="msui_navTop-right msui_navTop-cnav"><i class="micon-cnav"></i></a>
        </div>
        <div class="payResult">
            <img src="__STATIC__/home/images/err.png" alt="">
            <p class="fs07 text-center mtop08">支付失败</p>
        </div>
        <a href="javascript:;" class="close-popup payDefeated-btn cl-f">重新支付</a>
    </div>
</div>
{/block}

{block name="javascript"}
<script src="__STATIC__/home/js/payment.js"></script>
<script>
    $(function() {
        //    button是否可以点击
        if ($('.judge-lu').html()=='无可用琼露'){
            $('#switchCP-lu').attr('disabled','disabled');
        }else{
            $('#switchCP-lu').removeAttr('disabled');
        }
        $('.luCount-money').html($('.luCount').html()*.1);

        //提交订单
        $('.submitOrder').click(function (e) {
            var _data = {
                model : '{$data.model}',
                order_id : '{$data.order_id}',
                user_integral : $('input[name="user_integral"]').prop('checked') ? 1 : 0
            };

            var pay_type = $(".micon-checked").data('pay-type');

            if (pay_type == 'wxpay') {
                $.showLoading();
                wechat_pay(_data);
            } else if (pay_type == 'money'){
                // 验证是否有设置支付密码
                // 拉起支付密码面板
                // 输入支付密码，验证支付密码是否正确，完成支付
                SCOPE.order_data = {
                    model : '{$data.model}',
                    order_id : '{$data.order_id}',
                    use_clothes_money : $('input[name="use_clothes_money"]').prop('checked') ? 1 : 0
                };
                check_is_set_safe_password();
            }
        })
    });
</script>
{/block}